<?php

$images_url = base_url('images');
$admin_url = base_url('otakkanan');
$kirim_url = base_url('otakkiri');

$mapdir = "
	<a href='$admin_url/' class='taut'>Home</a>
	&gt; 
	<b>Laporan Link</b>
";

$tampil = "";

$menu = $this->uri->segment(3, "all");

if($menu == "detail")
{
	$idl = $this->input->get('id');
	$laporan = $this->adminmodel->get_data_lapor($idl);
	
	if($laporan !== FALSE)
	{
		foreach($laporan AS $ldata)
		{
			$link = html_escape($ldata->tautan);
			$nama = html_escape($ldata->nama);
			$email = safe_mailto(html_escape($ldata->email));
			$alasan = html_escape($ldata->alasan);
			$ip = $ldata->alamatip;
			$tanggal = $ldata->jam;
			
			$tampil = "
			<tr><td class='left'>Dari</td><td class='right'>$nama ($email) &nbsp; <a href='$kirim_url/hapuslaporan?id=$ldata->idlaporan' onclick='return konfirmasi_hapus()'>Hapus</a></td></tr> 
			<tr><td class='left'>Alasan</td><td class='right'>$alasan </td></tr>
			<tr><td class='left'>Dari IP</td><td class='right'>$ip</td></tr>
			<tr><td class='left'>Pada</td><td class='right'>$tanggal</td></tr>
			<tr><td class='left'>tautan</td><td class='right'>$link <br /><a href='$link' target='_blank'>Lihat Tautan langsung</a></td></tr>
			";
		}
	}else{
		$tampil = "<tr><td class='left'>&nbsp;</td><td class='right'>Data Tidak Ditemukan</td></tr>";
	}
	
	$tampil .= "<tr><td class='left'>&nbsp;</td><td class='right'><br /><a href='$admin_url/laporan' class='taut'>&lt; Kembali</a></td></tr>";
}
else{
	$awal = $this->input->get('awal');
	$laporan = $this->adminmodel->get_lapor($awal);
	
	$config['base_url'] = $admin_url.'/laporan?what=new';
	$config['total_rows'] = $this->adminmodel->hitung_data('idlaporan','dn_report');
	$config['per_page'] = 20; 
	$config['anchor_class'] = 'class="taut"';
	$config['page_query_string'] = TRUE;
	$config['query_string_segment'] = 'awal';

	$this->pagination->initialize($config); 
	$halaman = $this->pagination->create_links();
	
	if($laporan !== FALSE)
	{
		$tampil .= 
		"<tr><td class='left'>Dari</td><td class='right'>Laporan</td></tr><tr><td class='left'>&nbsp;</td><td class='right'>&nbsp;</td></tr>";
		foreach($laporan AS $ldata){
			$id = $ldata->idlaporan;
			$nama = html_escape($ldata->nama);
			$alasan = html_escape(word_limiter($ldata->alasan, 20));
			$link = html_escape($ldata->tautan);
			
			$tampil .= "
			<tr>
			<td class='left'>$nama</td>
			<td class='right'>
				$alasan &nbsp; <a href='$admin_url/laporan/detail?id=$id'>Detail</a> <br />
				<a target='_blank' href='$link'>$link</a>
			</td>
			</tr>";
		}
	}else{
		$tampil = "<tr><td class='left'>&nbsp;</td><td class='right'>Belum Ada Laporan coy</td></tr>";
	}
	
	$tampil .= "<tr><td class='left'>&nbsp;</td><td class='right'>$halaman</td></tr>";
}


$isipage = "
	<div id='content2'>
			<h3>Laporan Link</h3>
				
				<div class='isicontent2'>
					
						<table>
							<tbody>
								
								$tampil
								
								
							</tbody>
						</table>
						
				</div>
				
			</div>
";

$data['map_dir'] = $mapdir;
$data['isi_page'] = $isipage;
$data['site_title'] = 'Masukan - Dadan Network';
$data['base_url'] = base_url();
$data['tahun_sekarang'] = date("Y");

$this->parser->parse('template/admin', $data);

/* End of file laporan.php */
/* Location: ./application/views/admin/laporan.php */
